﻿using System;
using System.Collections.Generic;
using SharpStockLib.Data;

namespace SharpStockLib.DataAccess
{
    /// <summary>
    /// Generic interface any data provider should implement.
    /// </summary>
    public interface IDataProvider
    {
        /// <summary>
        /// Returns the historical data as an IObservable in order to be able to read data asynchronously thanks to Rx.
        /// </summary>
        /// <param name="instrumentName">Name of the instrument ; e.g. YHOO, XOM, /6E, etc...</param>
        /// <param name="startDate">Date from which the data must be retrieved.</param>
        /// <param name="endDate">Date until which the data must be retrieved.</param>
        /// <returns>An IObservable feed that the consumer will be able to use asynchronously.</returns>
        IObservable<IData> GetHistoricalDataAsync(string instrumentName, DateTime? startDate, DateTime? endDate);

        /// <summary>
        /// Synchronous method helper. Rx is great to some extent but can harm performance sometimes.
        /// </summary>
        /// <param name="symbol">Name of the instrument ; e.g. YHOO, XOM, /6E, etc...</param>
        /// <param name="startDate">Date from which the data must be retrieved.</param>
        /// <param name="endDate">Date until which the data must be retrieved.</param>
        /// <returns>An IEnumerable containing all historical data.</returns>
        IEnumerable<IData> GetHistoricalData(string symbol, DateTime? startDate, DateTime? endDate);
    }
}
